<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="vo.*, java.util.List"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
	String root = request.getContextPath();
	String userid = (String)session.getAttribute("userid");

	ListVO list = (ListVO)request.getAttribute("boardList");
	int postCount = list.getPostCount();
%>

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>글 목록</title>
</head>
<body>
<a href="<%=root%>/index.jsp">MAIN</a>
<table border="1" style="width: 920px" cellpadding="2">
	<tr>
		<td style="text-align: center"><h1>게  시  판</h1></td>
	</tr>
	<tr>
		<td style="height: 10px"></td>
	</tr>
	<tr>
		<td><table border="1" width="100%">
			<tr>
				<td>NO</td>
				<td>TITLE</td>
				<td>USER</td>
				<td>DATE</td>
				<td>HIT</td>		
			</tr>
		<%	for (int i = 0; i < postCount; i++) {	
			BoardVO boardVO = list.getBoardList().get(i);
		%>		
			<tr>
				<td><%= i + 1 %></td>
				<td><a href="<%=root %>/read.do?brdno=<%= boardVO.getBrdNo() %>"><%= boardVO.getBrdTitle() %></a></td>
				<td><%= boardVO.getBrdUser() %></td>
				<td><%= boardVO.getBrdDate() %></td>
				<td><%= boardVO.getBrdCnt() %></td>
			</tr>
		<%	}	%>
		
		</table></td>
	</tr>
	<tr>
		<td style="height: 10px"></td>
	</tr>
	<tr align="right">
		<td>
		<% if (userid != null) { %>
			<a href="<%=root %>/board/write_form.jsp">WRITE</a>
		<% } %>
			
		</td>
	</tr>
</table>
</body>
</html>